summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_client_session.h
blob: 0c750d7567afdefdf569e1829d8bc6eb47299763 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <string>

#include "core/hle/kernel/k_auto_object.h"
#include "core/hle/kernel/slab_helpers.h"
#include "core/hle/result.h"

union Result;

namespace Core::Memory {
class Memory;
}

namespace Core::Timing {
class CoreTiming;
}

namespace Kernel {

class KernelCore;
class KSession;
class KThread;

class KClientSession final
    : public KAutoObjectWithSlabHeapAndContainer<KClientSession, KAutoObjectWithList> {
    KERNEL_AUTOOBJECT_TRAITS(KClientSession, KAutoObject);

public:
    explicit KClientSession(KernelCore& kernel_);
    ~KClientSession() override;

    void Initialize(KSession* parent_session_, std::string&& name_) {
        // Set member variables.
        parent = parent_session_;
        name = std::move(name_);
    }

    void Destroy() override;
    static void PostDestroy([[maybe_unused]] uintptr_t arg) {}

    KSession* GetParent() const {
        return parent;
    }

    Result SendSyncRequest(KThread* thread, Core::Memory::Memory& memory,
                           Core::Timing::CoreTiming& core_timing);

    void OnServerClosed();

private:
    KSession* parent{};
};

} // namespace Kernel